furny.ga.util
Class FurnLayoutIOUtil

java.lang.Object
  extended by furny.ga.util.FurnLayoutIOUtil

public final class FurnLayoutIOUtil
extends java.lang.Object

Utility class for handling furniture IO.

Since:
11.08.2012
Author:
Stephan Dreyer

Field Summary
private static java.io.File lastDir
           
private static java.util.logging.Logger LOGGER
           
 
Constructor Summary
private FurnLayoutIOUtil()
          Instantiation is not allowed.
 
Method Summary
static FurnLayoutIndividual loadGenotype(java.awt.Component parent, FurnLayoutIndividual ind)
          Loads a furniture layout individual by opening a JFileChooser, loading and parsing the file.
static boolean parse(FurnLayoutIndividual ind, java.lang.String string)
          Parses the content of a furniture layout individual from a string.
static FurnLayoutIndividual parseIndividual(java.lang.String string)
          Creates a furniture layout individual from a string.
static java.lang.String printGenotypes(java.util.List<FurnLayoutIndividual> list)
          Prints the simple genotypes of a list of individuals to a string.
static java.lang.String printSimpleGenotype(long[][] store)
          Prints the simple genotype to a string.
static int saveGenotype(java.awt.Component parent, FurnLayoutIndividual ind)
          Saves a furniture layout individual by opening a JFileChooser, writing and saving the file.
static void writeFitness(FurnLayoutIndividual ind, java.lang.StringBuilder sb)
          Writes the fitness of a furniture layout individual to a string builder.
static void writeSimpleGenotype(long[][] store, java.lang.StringBuilder sb)
          Prints the simple genotype to a string builder.
static void writeSimpleGenotypeHeader(java.lang.StringBuilder sb)
          Writes the header of a simple genotype to a string builder.
static void writeSimpleGenotypeSet(long[][] store, java.lang.StringBuilder sb)
          Prints the simple genotype in set notation to a string builder.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER

private static final java.util.logging.Logger LOGGER

lastDir

private static java.io.File lastDir
Constructor Detail

FurnLayoutIOUtil

private FurnLayoutIOUtil()
Instantiation is not allowed.

Since:
11.08.2012
Method Detail

printSimpleGenotype

public static java.lang.String printSimpleGenotype(long[][] store)
Prints the simple genotype to a string.

Parameters:
store - The simple genotype.
Returns:
The string of the genotype.
Since:
11.08.2012

printGenotypes

public static java.lang.String printGenotypes(java.util.List<FurnLayoutIndividual> list)
Prints the simple genotypes of a list of individuals to a string.

Parameters:
list - The list of individuals.
Returns:
The string representation.
Since:
11.08.2012

parseIndividual

public static FurnLayoutIndividual parseIndividual(java.lang.String string)
Creates a furniture layout individual from a string.

Parameters:
string - The string to parse.
Returns:
The individual.
Since:
11.08.2012

parse

public static boolean parse(FurnLayoutIndividual ind,
                            java.lang.String string)
Parses the content of a furniture layout individual from a string.

Parameters:
ind - Individual to parse to.
string - The string to parse.
Returns:
The individual.
Since:
11.08.2012

writeSimpleGenotypeHeader

public static void writeSimpleGenotypeHeader(java.lang.StringBuilder sb)
Writes the header of a simple genotype to a string builder.

Parameters:
sb - The string builder.
Since:
11.08.2012

writeSimpleGenotype

public static void writeSimpleGenotype(long[][] store,
                                       java.lang.StringBuilder sb)
Prints the simple genotype to a string builder.

Parameters:
store - Simple genotype.
sb - String builder.
Since:
11.08.2012

writeSimpleGenotypeSet

public static void writeSimpleGenotypeSet(long[][] store,
                                          java.lang.StringBuilder sb)
Prints the simple genotype in set notation to a string builder.

Parameters:
store - The simple genotype.
sb - The string builder to write to.
Since:
11.08.2012

writeFitness

public static void writeFitness(FurnLayoutIndividual ind,
                                java.lang.StringBuilder sb)
Writes the fitness of a furniture layout individual to a string builder.

Parameters:
ind - The individual.
sb - The string builder to write to.
Since:
11.08.2012

loadGenotype

public static FurnLayoutIndividual loadGenotype(java.awt.Component parent,
                                                FurnLayoutIndividual ind)
Loads a furniture layout individual by opening a JFileChooser, loading and parsing the file.

Parameters:
parent - Parent for the file chooser, may be null.
ind - The individual to write the genotype to, may be null.
Returns:
The loaded individual.
Since:
11.08.2012

saveGenotype

public static int saveGenotype(java.awt.Component parent,
                               FurnLayoutIndividual ind)
Saves a furniture layout individual by opening a JFileChooser, writing and saving the file.

Parameters:
parent - Parent for the file chooser, may be null.
ind - The individual to save.
Returns:
The status, JOptionPane.OK_OPTION if all is ok.
Since:
11.08.2012